package com.example.demo.enums;


import lombok.Getter;


@Getter
public enum ElementTypeEnum {

    ID_ELEMENT("id", 0),
    NAME_ELEMENT("name", 1),
    XPATH_ELEMENT("xpath", 2),
    CLASS_ELEMENT("class", 3);


    private String name;
    private int value;

    ElementTypeEnum(String name, int value) {
        this.name = name;
        this.value = value;
    }

    /**
     * int类型转换成枚举类型
     *
     * @param value 对应枚举的int 类型
     * @return 返回枚举数据
     */

    public static ElementTypeEnum valueOfType(int value) {
        switch (value) {
            case 0:
                return ID_ELEMENT;
            case 1:
                return NAME_ELEMENT;
            case 2:
                return XPATH_ELEMENT;
            case 3:
                return CLASS_ELEMENT;
            default:
                return null;
        }
    }


}
